<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>04.场景管理类 | 个人笔记</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.9">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../../gitbook的安装.html" />
    
    
    <link rel="prev" href="../../md/Egret/03.typeScript.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="7.6"
        data-chapter-title="04.场景管理类"
        data-filepath="md/Egret/04.场景管理类.md"
        data-basepath="../.."
        data-revision="Wed Jan 09 2019 23:47:24 GMT+0800 (中国标准时间)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        Introduction
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="md/html/html介绍.html">
            
                
                    <a href="../../md/html/html介绍.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        html介绍
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="md/html/html常用标签.html">
            
                
                    <a href="../../md/html/html常用标签.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        html常用标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="md/html/a标签的使用.html">
            
                
                    <a href="../../md/html/a标签的使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        a标签的使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="md/html/表格的介绍.html">
            
                
                    <a href="../../md/html/表格的介绍.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        表格的介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="md/html/列表.html">
            
                
                    <a href="../../md/html/列表.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        列表
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="md/html/iframe内嵌框架.html">
            
                
                    <a href="../../md/html/iframe内嵌框架.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        iframe内嵌框架
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="md/html/表单.html">
            
                
                    <a href="../../md/html/表单.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.</b>
                        
                        表单
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="md/html/媒体标签.html">
            
                
                    <a href="../../md/html/媒体标签.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.7.</b>
                        
                        媒体标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="md/html/下拉框，多行文本域以及对齐方式.html">
            
                
                    <a href="../../md/html/下拉框，多行文本域以及对齐方式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.8.</b>
                        
                        清除样式
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="md/css/css引入方式.html">
            
                
                    <a href="../../md/css/css引入方式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        css引入方式
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="md/css/css选择符与选择器.html">
            
                
                    <a href="../../md/css/css选择符与选择器.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        css选择符与选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="md/css/css字体样式.html">
            
                
                    <a href="../../md/css/css字体样式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        css字体样式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="md/css/图片的调整.html">
            
                
                    <a href="../../md/css/图片的调整.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        图片的调整
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="md/css/伪类选择.html">
            
                
                    <a href="../../md/css/伪类选择.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        伪类选择
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="md/css/盒子模型.html">
            
                
                    <a href="../../md/css/盒子模型.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        盒子模型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="md/css/浮动.html">
            
                
                    <a href="../../md/css/浮动.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.6.</b>
                        
                        浮动
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="md/css/定位.html">
            
                
                    <a href="../../md/css/定位.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.7.</b>
                        
                        定位
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="md/css/阴影.html">
            
                
                    <a href="../../md/css/阴影.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.8.</b>
                        
                        阴影
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.9" data-path="md/css/图片溢出处理.html">
            
                
                    <a href="../../md/css/图片溢出处理.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.9.</b>
                        
                        图片溢出处理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.10" data-path="md/css/动画.html">
            
                
                    <a href="../../md/css/动画.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.10.</b>
                        
                        动画
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.11" data-path="md/css/动画插件与浏览器内核.html">
            
                
                    <a href="../../md/css/动画插件与浏览器内核.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.11.</b>
                        
                        动画插件与浏览器内核
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.12" data-path="md/css/旋转菜单.html">
            
                
                    <a href="../../md/css/旋转菜单.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.12.</b>
                        
                        旋转菜单
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.13" data-path="md/css/视口.html">
            
                
                    <a href="../../md/css/视口.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.13.</b>
                        
                        移动端
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.14" data-path="md/css/rem布局.html">
            
                
                    <a href="../../md/css/rem布局.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.14.</b>
                        
                        rem布局
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.15" data-path="md/css/权重与雪碧图.html">
            
                
                    <a href="../../md/css/权重与雪碧图.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.15.</b>
                        
                        权重问题
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.16" data-path="md/css/移动底部菜单被系统键盘顶起问题.html">
            
                
                    <a href="../../md/css/移动底部菜单被系统键盘顶起问题.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.16.</b>
                        
                        移动端导航问题
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.17" data-path="md/css/flex布局.html">
            
                
                    <a href="../../md/css/flex布局.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.17.</b>
                        
                        flex布局
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.18" data-path="md/css/fullpage的使用.html">
            
                
                    <a href="../../md/css/fullpage的使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.18.</b>
                        
                        fullpage
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.19" data-path="md/css/bootstrap.html">
            
                
                    <a href="../../md/css/bootstrap.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.19.</b>
                        
                        bootstrap
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.20" data-path="md/css/媒体查询.html">
            
                
                    <a href="../../md/css/媒体查询.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.20.</b>
                        
                        媒体查询
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="md/js/js的介绍.html">
            
                
                    <a href="../../md/js/js的介绍.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        JavaScript的介绍
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="md/js/JavaScript数据类型.html">
            
                
                    <a href="../../md/js/JavaScript数据类型.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        JavaScript数据类型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="md/js/数据类型的转换.html">
            
                
                    <a href="../../md/js/数据类型的转换.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        数据类型的转换
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="md/js/运算符.html">
            
                
                    <a href="../../md/js/运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="md/js/比较运算符.html">
            
                
                    <a href="../../md/js/比较运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.4.</b>
                        
                        比较运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="md/js/赋值运算符.html">
            
                
                    <a href="../../md/js/赋值运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.5.</b>
                        
                        赋值运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.6" data-path="md/js/逻辑操作符.html">
            
                
                    <a href="../../md/js/逻辑操作符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.6.</b>
                        
                        逻辑操作符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.7" data-path="md/js/条件语句.html">
            
                
                    <a href="../../md/js/条件语句.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.7.</b>
                        
                        条件语句
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.8" data-path="md/js/条件运算符.html">
            
                
                    <a href="../../md/js/条件运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.8.</b>
                        
                        条件运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.9" data-path="md/js/位运算符.html">
            
                
                    <a href="../../md/js/位运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.9.</b>
                        
                        位运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.10" data-path="md/js/循环语句.html">
            
                
                    <a href="../../md/js/循环语句.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.10.</b>
                        
                        循环语句
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.11" data-path="md/js/for循环.html">
            
                
                    <a href="../../md/js/for循环.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.11.</b>
                        
                        for循环
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.12" data-path="md/js/ES6.html">
            
                
                    <a href="../../md/js/ES6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.12.</b>
                        
                        ES6
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.13" data-path="md/js/es6安装.html">
            
                
                    <a href="../../md/js/es6安装.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.13.</b>
                        
                        ES6安装
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.14" data-path="md/js/内置对象.html">
            
                
                    <a href="../../md/js/内置对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.14.</b>
                        
                        内置对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.15" data-path="md/js/Array对象.html">
            
                
                    <a href="../../md/js/Array对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.15.</b>
                        
                        Array对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.16" data-path="md/js/Date对象.html">
            
                
                    <a href="../../md/js/Date对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.16.</b>
                        
                        Date对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.17" data-path="md/js/布尔值对象.html">
            
                
                    <a href="../../md/js/布尔值对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.17.</b>
                        
                        布尔值对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.18" data-path="md/js/数学对象.html">
            
                
                    <a href="../../md/js/数学对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.18.</b>
                        
                        数学对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.19" data-path="md/js/对象的创建.html">
            
                
                    <a href="../../md/js/对象的创建.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.19.</b>
                        
                        对象的创建
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.20" data-path="md/js/BOM.html">
            
                
                    <a href="../../md/js/BOM.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.20.</b>
                        
                        BOM
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.21" data-path="md/js/DOM关于元素的获取.html">
            
                
                    <a href="../../md/js/DOM关于元素的获取.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.21.</b>
                        
                        DOM关于元素的获取
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.22" data-path="md/js/DOM元素对象.html">
            
                
                    <a href="../../md/js/DOM元素对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.22.</b>
                        
                        DOM元素对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.23" data-path="md/js/DOM事件练习.html">
            
                
                    <a href="../../md/js/DOM事件练习.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.23.</b>
                        
                        DOM事件练习
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.24" data-path="md/js/DOM鼠标事件.html">
            
                
                    <a href="../../md/js/DOM鼠标事件.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.24.</b>
                        
                        DOM鼠标事件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.25" data-path="md/js/事件代理.html">
            
                
                    <a href="../../md/js/事件代理.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.25.</b>
                        
                        事件代理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.26" data-path="md/js/移动端事件.html">
            
                
                    <a href="../../md/js/移动端事件.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.26.</b>
                        
                        移动端事件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.27" data-path="md/js/无缝轮播图.html">
            
                
                    <a href="../../md/js/无缝轮播图.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.27.</b>
                        
                        无缝轮播图
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.28" data-path="md/js/鼠标事件练习.html">
            
                
                    <a href="../../md/js/鼠标事件练习.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.28.</b>
                        
                        鼠标事件练习
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.29" data-path="md/js/ajax.html">
            
                
                    <a href="../../md/js/ajax.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.29.</b>
                        
                        ajax
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.30" data-path="md/js/封装ajax.html">
            
                
                    <a href="../../md/js/封装ajax.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.30.</b>
                        
                        封装ajax
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.31" data-path="md/js/高德地图的使用.html">
            
                
                    <a href="../../md/js/高德地图的使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.31.</b>
                        
                        高德地图的使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.32" data-path="md/js/预加载插件使用.html">
            
                
                    <a href="../../md/js/预加载插件使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.32.</b>
                        
                        预加载插件使用
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="md/jQuery/JQ变量的声明.html">
            
                
                    <a href="../../md/jQuery/JQ变量的声明.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        JQ变量的声明
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="md/jQuery/选择器和效果.html">
            
                
                    <a href="../../md/jQuery/选择器和效果.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        选择器和效果
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="md/jQuery/属性.html">
            
                
                    <a href="../../md/jQuery/属性.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        属性
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="md/jQuery/尺寸.html">
            
                
                    <a href="../../md/jQuery/尺寸.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.</b>
                        
                        尺寸
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="md/jQuery/遍历.html">
            
                
                    <a href="../../md/jQuery/遍历.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.</b>
                        
                        遍历
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="md/jQuery/正则表达式.html">
            
                
                    <a href="../../md/jQuery/正则表达式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.5.</b>
                        
                        正则表达式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.6" data-path="md/jQuery/jQuery事件练习.html">
            
                
                    <a href="../../md/jQuery/jQuery事件练习.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.6.</b>
                        
                        jQuery事件练习
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.7" data-path="md/jQuery/操作.html">
            
                
                    <a href="../../md/jQuery/操作.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.7.</b>
                        
                        操作
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.8" data-path="md/jQuery/事件.html">
            
                
                    <a href="../../md/jQuery/事件.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.8.</b>
                        
                        事件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.9" data-path="md/jQuery/ajax.html">
            
                
                    <a href="../../md/jQuery/ajax.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.9.</b>
                        
                        ajax
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.10" data-path="md/jQuery/三级联动.html">
            
                
                    <a href="../../md/jQuery/三级联动.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.10.</b>
                        
                        三级联动
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.11" data-path="md/jQuery/滚动监听导航效果.html">
            
                
                    <a href="../../md/jQuery/滚动监听导航效果.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.11.</b>
                        
                        滚动监听导航效果
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.12" data-path="md/jQuery/悬停导航.html">
            
                
                    <a href="../../md/jQuery/悬停导航.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.12.</b>
                        
                        悬停导航
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="md/Vue/修饰符与条件渲染.html">
            
                
                    <a href="../../md/Vue/修饰符与条件渲染.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        Vue修饰符与条件渲染
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1" data-path="md/Vue/绑定class和style.html">
            
                
                    <a href="../../md/Vue/绑定class和style.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.1.</b>
                        
                        绑定class和style
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="md/Vue/排序.html">
            
                
                    <a href="../../md/Vue/排序.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.2.</b>
                        
                        排序
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="md/Vue/表单输入绑定.html">
            
                
                    <a href="../../md/Vue/表单输入绑定.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.3.</b>
                        
                        表单输入绑定
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.4" data-path="md/Vue/生命周期.html">
            
                
                    <a href="../../md/Vue/生命周期.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.4.</b>
                        
                        生命周期
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.5" data-path="md/Vue/自定义指令.html">
            
                
                    <a href="../../md/Vue/自定义指令.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.5.</b>
                        
                        自定义指令
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.6" data-path="md/Vue/组件.html">
            
                
                    <a href="../../md/Vue/组件.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.6.</b>
                        
                        组件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.7" data-path="md/Vue/Vue事件练习.html">
            
                
                    <a href="../../md/Vue/Vue事件练习.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.7.</b>
                        
                        Vue事件练习
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.8" data-path="md/Vue/动态模板.html">
            
                
                    <a href="../../md/Vue/动态模板.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.8.</b>
                        
                        动态模板
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.9" data-path="md/Vue/插槽的使用.html">
            
                
                    <a href="../../md/Vue/插槽的使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.9.</b>
                        
                        插槽的使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.10" data-path="md/Vue/router.html">
            
                
                    <a href="../../md/Vue/router.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.10.</b>
                        
                        router
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.11" data-path="md/Vue/ajax与框架搭建.html">
            
                
                    <a href="../../md/Vue/ajax与框架搭建.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.11.</b>
                        
                        ajax与框架搭建
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.12" data-path="md/Vue/store.html">
            
                
                    <a href="../../md/Vue/store.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.12.</b>
                        
                        store
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5.13" data-path="md/Vue/ref获取元素.html">
            
                
                    <a href="../../md/Vue/ref获取元素.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.13.</b>
                        
                        ref获取元素
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6" data-path="md/wx/小程序.html">
            
                
                    <a href="../../md/wx/小程序.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        小程序
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1" data-path="md/wx/封装外部ajax路径.html">
            
                
                    <a href="../../md/wx/封装外部ajax路径.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.1.</b>
                        
                        封装外部ajax路径
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="md/wx/自定义组件.html">
            
                
                    <a href="../../md/wx/自定义组件.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.2.</b>
                        
                        自定义组件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="md/wx/三列选择器.html">
            
                
                    <a href="../../md/wx/三列选择器.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.3.</b>
                        
                        三列选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.4" data-path="md/wx/练习.html">
            
                
                    <a href="../../md/wx/练习.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.4.</b>
                        
                        练习
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="7" data-path="md/Egret/canvas.html">
            
                
                    <a href="../../md/Egret/canvas.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.</b>
                        
                        canvas
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="7.1" data-path="md/Egret/async.html">
            
                
                    <a href="../../md/Egret/async.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.1.</b>
                        
                        async
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.2" data-path="md/Egret/显示对象与容器.html">
            
                
                    <a href="../../md/Egret/显示对象与容器.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.2.</b>
                        
                        显示对象与容器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.3" data-path="md/Egret/01.基础.html">
            
                
                    <a href="../../md/Egret/01.基础.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.3.</b>
                        
                        01.基础
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.4" data-path="md/Egret/02.对象池.html">
            
                
                    <a href="../../md/Egret/02.对象池.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.4.</b>
                        
                        02.对象池
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7.5" data-path="md/Egret/03.typeScript.html">
            
                
                    <a href="../../md/Egret/03.typeScript.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.5.</b>
                        
                        03.typeScript
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="7.6" data-path="md/Egret/04.场景管理类.html">
            
                
                    <a href="../../md/Egret/04.场景管理类.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.6.</b>
                        
                        04.场景管理类
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="8" data-path="gitbook的安装.html">
            
                
                    <a href="../../gitbook的安装.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.</b>
                        
                        gitbook的安装
                    </a>
            
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../" >个人笔记</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="&#x573A;&#x666F;&#x7BA1;&#x7406;&#x7C7B;">&#x573A;&#x666F;&#x7BA1;&#x7406;&#x7C7B;</h1>
<p><strong><em> &#x5DE5;&#x5177;&#x7C7B;</em></strong>  </p>
<pre><code class="lang-JavaScript"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Utils</span> </span>{
    public constructor() {
    }

    static creatImg(imgName,x=<span class="hljs-number">0</span>,y=<span class="hljs-number">0</span>){
        <span class="hljs-keyword">let</span> img = <span class="hljs-keyword">new</span> egret.Bitmap();
        img.x = x;
        img.y = y;
        img.texture = RES.getRes(imgName);
        <span class="hljs-keyword">return</span> img;
    }

    static createRect(x,y,w,h,bgColor,lineW=<span class="hljs-number">0</span>,lineColor=<span class="hljs-number">0x000000</span>){
        <span class="hljs-keyword">let</span> shape = <span class="hljs-keyword">new</span> egret.Shape();
        shape.graphics.lineStyle(lineW,lineColor);
        shape.graphics.beginFill(bgColor);
        shape.graphics.drawRect(<span class="hljs-number">0</span>,<span class="hljs-number">0</span>,w,h);
        shape.x = x;
        shape.y = y;
        shape.graphics.endFill();
        <span class="hljs-keyword">return</span> shape;
    }

    static createTxt(text,x=<span class="hljs-number">0</span>,y=<span class="hljs-number">0</span>,size=<span class="hljs-number">30</span>,color=<span class="hljs-number">0x000000</span>,textAlign=<span class="hljs-string">&quot;center&quot;</span>,verticalAlign=<span class="hljs-string">&quot;middle&quot;</span>){
        <span class="hljs-keyword">let</span> textField = <span class="hljs-keyword">new</span> egret.TextField();
        textField.textColor = color;
        textField.textAlign = textAlign;
        textField.verticalAlign = verticalAlign;
        textField.size = size;
        textField.x = x;
        textField.y = y;
        textField.text = text;
        <span class="hljs-keyword">return</span> textField;
    }

    static creatBtn(x,y,width,height,text,callBack=<span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{},fontSize=<span class="hljs-number">40</span>,bgColor=<span class="hljs-number">0x006699</span>,fontColor=<span class="hljs-number">0xCC3366</span>,hoverBgColor=<span class="hljs-number">0xFFCC00</span>,hoverFontColor=<span class="hljs-number">0x000000</span>){
        <span class="hljs-keyword">let</span> sprite = <span class="hljs-keyword">new</span> egret.Sprite();
        <span class="hljs-comment">//&#x6309;&#x94AE;&#x77E9;&#x5F62;</span>
        sprite.graphics.beginFill(bgColor);
        sprite.x = x;
        sprite.y = y;
        sprite.graphics.drawRect(<span class="hljs-number">0</span>,<span class="hljs-number">0</span>,width,height);
        sprite.graphics.endFill();
        <span class="hljs-comment">//&#x6309;&#x94AE;&#x6587;&#x5B57;</span>
        <span class="hljs-keyword">let</span> txt = <span class="hljs-keyword">new</span> egret.TextField();
        txt.width = width;
        txt.height = height;
        txt.textAlign = egret.HorizontalAlign.CENTER;
        txt.verticalAlign = egret.VerticalAlign.MIDDLE;
        txt.text = text;
        txt.size = fontSize;
        txt.textColor = fontColor;
        sprite.addChild(txt);

        <span class="hljs-comment">//&#x70B9;&#x51FB;&#x4E8B;&#x4EF6;</span>
        <span class="hljs-comment">//sprite.touchChildren = true;</span>
        sprite.touchEnabled = <span class="hljs-literal">true</span>;
        sprite.addEventListener(egret.TouchEvent.TOUCH_BEGIN,<span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
            sprite.graphics.clear();<span class="hljs-comment">//&#x5148;&#x64E6;&#x9664;&#x4E4B;&#x524D;&#x7684;&#x7ED8;&#x5236;</span>
            <span class="hljs-keyword">this</span>.graphics.beginFill(hoverBgColor);
            <span class="hljs-keyword">this</span>.x = x;
            <span class="hljs-keyword">this</span>.y = y;
            <span class="hljs-keyword">this</span>.graphics.drawRect(<span class="hljs-number">0</span>,<span class="hljs-number">0</span>,width,height);
            <span class="hljs-keyword">this</span>.graphics.endFill();

            txt.textColor = hoverFontColor;

        },sprite)
        sprite.addEventListener(egret.TouchEvent.TOUCH_END,<span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
            touchEnd.call(sprite);
        },sprite)

        sprite.addEventListener(egret.TouchEvent.TOUCH_RELEASE_OUTSIDE,<span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
            touchEnd.call(sprite);
        },sprite)


        <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">touchEnd</span>(<span class="hljs-params"></span>)</span>{
            <span class="hljs-comment">// console.log(this);</span>
            sprite.graphics.clear();<span class="hljs-comment">//&#x5148;&#x64E6;&#x9664;&#x4E4B;&#x524D;&#x7684;&#x7ED8;&#x5236;</span>
            sprite.graphics.beginFill(bgColor);
            sprite.x = x;
            sprite.y = y;
            sprite.graphics.drawRect(<span class="hljs-number">0</span>,<span class="hljs-number">0</span>,width,height);
            sprite.graphics.endFill();

            txt.textColor = fontColor;

            <span class="hljs-keyword">typeof</span> callBack == <span class="hljs-string">&quot;function&quot;</span> &amp;&amp; callBack();
        }
        <span class="hljs-keyword">return</span> sprite;
    }

    static timeFormat(num){
        num = <span class="hljs-built_in">Math</span>.floor(num);
        <span class="hljs-keyword">let</span> sec = num % <span class="hljs-number">60</span>;
        <span class="hljs-keyword">let</span> min = <span class="hljs-built_in">Math</span>.floor(num/<span class="hljs-number">60</span>);
        <span class="hljs-keyword">let</span> finSec = sec&lt;<span class="hljs-number">10</span>?<span class="hljs-string">&quot;0&quot;</span>+sec:sec;
        <span class="hljs-keyword">let</span> finMin = min&lt;<span class="hljs-number">10</span>?<span class="hljs-string">&quot;0&quot;</span>+min:min;
        <span class="hljs-keyword">return</span> <span class="hljs-string">`<span class="hljs-subst">${finMin}</span>:<span class="hljs-subst">${finSec}</span>`</span>
    }
}
</code></pre>
<p><strong><em> &#x573A;&#x666F;&#x7BA1;&#x7406;&#x7C7B;</em></strong></p>
<pre><code class="lang-JavaScript"><span class="hljs-comment">/**
* &#x529F;&#x80FD;
*     1. &#x80FD;&#x591F;&#x5E2E;&#x6211;&#x4EEC;&#x81EA;&#x52A8;&#x52A0;&#x8F7D;&#x8D44;&#x6E90;
*     2. &#x9ED8;&#x8BA4;&#x81EA;&#x5E26;&#x8FDB;&#x5EA6;&#x6761;&#xFF0C;&#x5982;&#x679C;&#x8981;&#x7528;&#x81EA;&#x5DF1;&#x52A0;&#x8F7D;&#x9875;&#xFF0C;&#x7C7B;&#x540D;&#x8BF7;&#x5B9A;&#x4E49;&#x4E3A;LoadingUI,&#x5E76;&#x4E14;&#x5355;&#x4F8B;&#x6A21;&#x5F0F;&#x66B4;&#x9732;&#x9759;&#x6001;&#x65B9;&#x6CD5;getObj
*     3. &#x80FD;&#x591F;&#x5E2E;&#x6211;&#x4EEC;&#x5FEB;&#x901F;&#x5207;&#x6362;&#x573A;&#x666F;
* &#x8981;&#x6C42;
*     1. &#x81EA;&#x5B9A;&#x4E49;loadingUI&#x5FC5;&#x987B;&#x6539;&#x9020;&#x4E3A;&#x5355;&#x4F8B;&#x6A21;&#x5F0F;&#xFF0C;&#x66B4;&#x9732;&#x7684;&#x9759;&#x6001;&#x65B9;&#x6CD5;&#x4E3A;getObj
*     2. &#x81EA;&#x5B9A;&#x4E49;&#x5165;&#x573A;&#x52A8;&#x753B;&#xFF0C;&#x8BF7;&#x5728;&#x573A;&#x666F;&#x7C7B;&#x5185;&#x58F0;&#x660E;aniMyself&#x65B9;&#x6CD5;&#xFF0C;&#x63A5;&#x6536;callBack&#x4E3A;&#x53C2;&#x6570;&#xFF0C;&#x5E76;&#x4E14;&#x5728;&#x52A8;&#x753B;&#x7ED3;&#x675F;&#x56DE;&#x8C03;&#x5185;&#x6267;&#x884C;callBack;
* &#x8C03;&#x7528;&#x65F6;
* SceneManger.getObj(this.stage).loadScene(&quot;player&quot;,Player);
 */</span>
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">SceneManager</span> </span>{
    static instance;
    static getObj(stage){
        <span class="hljs-keyword">if</span>(!SceneManager.instance){
            SceneManager.instance = <span class="hljs-keyword">new</span> SceneManager(stage)
            <span class="hljs-keyword">return</span> SceneManager.instance
        }
        <span class="hljs-keyword">return</span> SceneManager.instance
    }
    public constructor(stage) {
        <span class="hljs-keyword">this</span>._stage = stage;
    }
    private _stage; <span class="hljs-comment">//&#x821E;&#x53F0;</span>
    private lastScene = <span class="hljs-literal">null</span>;
    public <span class="hljs-keyword">async</span> loadScene(groupName,SceneName){
         <span class="hljs-keyword">try</span> {
             <span class="hljs-comment">//&#x52A0;&#x8F7D;&#x8D44;&#x6E90;</span>
            <span class="hljs-keyword">let</span> loadingView;
            <span class="hljs-comment">//&#x5982;&#x679C;&#x9879;&#x76EE;&#x6709;loadingUI&#x7C7B;&#x5C31;&#x7528;&#x9879;&#x76EE;&#x81EA;&#x5E26;&#x7684;&#xFF0C;&#x5426;&#x5219;&#x7528;&#x5E95;&#x90E8;&#x81EA;&#x5B9A;&#x4E49;MyLoading</span>
            <span class="hljs-keyword">try</span>{
                loadingView = LoadingUI.getObj();
            }<span class="hljs-keyword">catch</span>(e){
                loadingView = MyLoading.createObj();
            }
            <span class="hljs-keyword">this</span>._stage.addChild(loadingView);
            <span class="hljs-keyword">await</span> RES.loadConfig(<span class="hljs-string">&quot;resource/default.res.json&quot;</span>, <span class="hljs-string">&quot;resource/&quot;</span>);
            <span class="hljs-keyword">await</span> RES.loadGroup(groupName, <span class="hljs-number">0</span>, loadingView);
            <span class="hljs-keyword">if</span>(loadingView &amp;&amp; <span class="hljs-keyword">this</span>._stage.contains(loadingView)){
                 <span class="hljs-keyword">this</span>._stage.removeChild(loadingView);
            }

            <span class="hljs-comment">//&#x52A0;&#x8F7D;&#x573A;&#x666F;</span>
            <span class="hljs-keyword">let</span> curScene = <span class="hljs-keyword">new</span> SceneName();
            <span class="hljs-keyword">this</span>._stage.addChild(curScene);
            <span class="hljs-keyword">if</span>(<span class="hljs-string">&apos;aniSelf&apos;</span> <span class="hljs-keyword">in</span> curScene){
                curScene.aniSelf(()=&gt;{
                    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">&quot;&#x52A8;&#x753B;&#x6267;&#x884C;&#x7ED3;&#x675F;&quot;</span>);
                    <span class="hljs-comment">//&#x52A8;&#x753B;&#x6267;&#x884C;&#x5B8C;&#x4EE5;&#x540E;&#x79FB;&#x9664;&#x4E4B;&#x524D;&#x7684;&#x573A;&#x666F;</span>
                    <span class="hljs-keyword">if</span>(<span class="hljs-keyword">this</span>.lastScene &amp;&amp; <span class="hljs-keyword">this</span>._stage.contains(<span class="hljs-keyword">this</span>.lastScene)){
                        <span class="hljs-keyword">this</span>._stage.removeChild(<span class="hljs-keyword">this</span>.lastScene);
                    }
                    <span class="hljs-keyword">this</span>.lastScene = curScene;
                })
            }<span class="hljs-keyword">else</span>{
                <span class="hljs-keyword">if</span>(<span class="hljs-keyword">this</span>.lastScene &amp;&amp; <span class="hljs-keyword">this</span>._stage.contains(<span class="hljs-keyword">this</span>.lastScene)){
                    <span class="hljs-keyword">this</span>._stage.removeChild(<span class="hljs-keyword">this</span>.lastScene);
                }
                <span class="hljs-keyword">this</span>.lastScene = curScene;
            }
        }
        <span class="hljs-keyword">catch</span> (e) {
            <span class="hljs-built_in">console</span>.error(e);
        }
    }
}

declare interface AddAni{
    aniSelf(cb:<span class="hljs-built_in">Object</span>)
}


<span class="hljs-comment">//&#x81EA;&#x5E26;&#x9ED8;&#x8BA4;loading&#x6761;</span>
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MyLoading</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">egret</span>.<span class="hljs-title">Sprite</span> <span class="hljs-title">implements</span> <span class="hljs-title">RES</span>.<span class="hljs-title">PromiseTaskReporter</span> </span>{
    private static obj;
    public static createObj(){
        <span class="hljs-keyword">if</span>(!<span class="hljs-keyword">this</span>.obj){<span class="hljs-keyword">this</span>.obj = <span class="hljs-keyword">new</span> <span class="hljs-keyword">this</span>;}
        <span class="hljs-keyword">return</span> <span class="hljs-keyword">this</span>.obj;
    }
    public constructor() {
        <span class="hljs-keyword">super</span>();
        <span class="hljs-keyword">this</span>.addEventListener(egret.Event.ADDED_TO_STAGE,<span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
            <span class="hljs-keyword">let</span> bgR = Utils.createRect(<span class="hljs-number">0</span>,<span class="hljs-number">0</span>,<span class="hljs-keyword">this</span>.stage.stageWidth,<span class="hljs-keyword">this</span>.stage.stageHeight,<span class="hljs-number">0xbb4aef</span>);
            <span class="hljs-keyword">this</span>.addChild(bgR);
            <span class="hljs-keyword">this</span>.proB = <span class="hljs-keyword">new</span> ProgressBar();
            <span class="hljs-keyword">this</span>.proB.pH = <span class="hljs-number">20</span>;
            <span class="hljs-keyword">this</span>.proB.pW = <span class="hljs-keyword">this</span>.stage.stageWidth*<span class="hljs-number">.8</span>;
            <span class="hljs-keyword">this</span>.proB.drawBorder();
            <span class="hljs-keyword">this</span>.proB.x = <span class="hljs-keyword">this</span>.stage.stageWidth&gt;&gt;<span class="hljs-number">1</span>;
            <span class="hljs-keyword">this</span>.proB.y = <span class="hljs-keyword">this</span>.stage.stageHeight&gt;&gt;<span class="hljs-number">1</span>;
            <span class="hljs-keyword">this</span>.addChild(<span class="hljs-keyword">this</span>.proB);
        },<span class="hljs-keyword">this</span>)
    }
    private proB:ProgressBar;
    public onProgress(current: number, total: number): <span class="hljs-keyword">void</span> {
        <span class="hljs-keyword">let</span> curW:number = <span class="hljs-keyword">this</span>.proB.pW*current/total
        <span class="hljs-keyword">this</span>.proB.drawBg(<span class="xml"><span class="hljs-tag">&lt;<span class="hljs-title">number</span>&gt;</span>curW);
    }
}
//Myloading&#x91CC;&#x9762;&#x8981;&#x7528;&#x5230;
class ProgressBar extends egret.Sprite{
    public constructor() { 
        super();
    }
    public pW:number = 200;
    public pH:number = 40;
    public drawBorder(){
        this.graphics.lineStyle(4,0x00ff00);
        this.graphics.beginFill(0xffffff,0);
        this.graphics.drawRoundRect(0,0,this.pW,this.pH,10,10);
        this.graphics.endFill();
        this.anchorOffsetX = this.pW&gt;&gt;1;
        this.anchorOffsetY = this.pH&gt;&gt;1;
    }
    private bgR:egret.Shape = new egret.Shape();
    public drawBg(width){
        width = width&gt;=this.pW-2?this.pW-4:width;
        this.bgR.graphics.clear();
        this.bgR.graphics.beginFill(0xeb6616);
        this.bgR.graphics.drawRect(2,2,width,this.pH-4);
        this.bgR.graphics.endFill();
        this.addChild(this.bgR);
    }
}
</span></code></pre>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../../md/Egret/03.typeScript.html" class="navigation navigation-prev " aria-label="Previous page: 03.typeScript"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../../gitbook的安装.html" class="navigation navigation-next " aria-label="Next page: gitbook的安装"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../../gitbook/app.js"></script>

    
    <script src="../../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-livereload/plugin.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"livereload":{}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
